import Vue from 'vue'

import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import {Message} from 'element-ui'
import {MessageBox} from 'element-ui'
import ZkTable from 'vue-table-with-tree-grid'

import './assets/fonts/iconfont.css'
import App from './App.vue'
// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
import axios from 'axios'
// 导入富文本编辑器对应的样式
import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme
Vue.use(ElementUI);
// Vue.use(axios)
Vue.use(VueQuillEditor)
Vue.prototype.$message = Message
Vue.config.productionTip = false
axios.defaults.baseURL='http://timemeetyou.com:8889/api/private/v1/'
// 请求拦截器,在以后的每一次对服务器的请求中,都将token放在请求头中
axios.interceptors.request.use(config=>{
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
Vue.prototype.$http = axios
Vue.prototype.$confirm = MessageBox.confirm
Vue.component("tree-table", ZkTable)
Vue.filter('dateFormat',function (originDate) {
  let dt = new Date(originDate)
  let y = dt.getFullYear()
  let m = (dt.getMonth() +1 +'').padStart(2,0)
  let d = (dt.getDay()+'').padStart(2,'0')
  let hh = (dt.getHours()+'').padStart(2,'0')
  let mm = (dt.getMinutes()+'').padStart(2,'0')
  let ss = (dt.getSeconds()+'').padStart(2,'0')
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
